Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File Logger that tracks changes to file operations to prevent looping #1436

Merged
merged 2 commits into from
Apr 16, 2023

Conversation

CalCameron
Copy link
Contributor

@CalCameron CalCameron commented Apr 14, 2023

Added a code feature for logging file operations, this should prevent looping. This will log 'Writes' and 'Deletes' only, that way Auto-GPT knows what it has updated previously, so it does not attempt to make the same changes twice.

If you have any questions, feel free to reach out

Background

Changes

Documentation

Test Plan

PR Quality Checklist

  • My pull request is atomic and focuses on a single change.
  • I have thoroughly tested my changes with multiple different prompts.
  • I have considered potential risks and mitigations for my changes.
  • I have documented my changes clearly and comprehensively.
  • I have not snuck in any "extra" small tweaks changes

nponeccop
nponeccop previously approved these changes Apr 14, 2023
@nponeccop nponeccop mentioned this pull request Apr 15, 2023
1 task
@BillSchumacher BillSchumacher merged commit b23b832 into Significant-Gravitas:master Apr 16, 2023
@Amraki
Copy link

Amraki commented Apr 17, 2023

Hi @CalCameron,
I'm running into an issue when AutoGPT attempts to change the contents of a file that it recently created, resulting in:

System: Command write_to_file returned: Error: File has already been updated.

To clarify, this isn't just appending text. It's a code file and some is being re-written so append_to_file shouldn't apply here.

As it's currently implemented, the check_duplicate_operation function doesn't take text content into account. Since the function is only called by the "write" and "delete" operations, checking if the filename exists may be a simpler way to determine repeat actions. For "write", maybe instead of reading a log file, the function can verify the file exists and then read_file to compare existing and new text content; only writing if different and erroring otherwise.

That being said, while I understand not wanting to get stuck in a loop, wasting time and money, I wonder if this is the best place to check for it? It may be more beneficial to handle that logic in a core function like execute_command in app.py.

@Amraki
Copy link

Amraki commented Apr 17, 2023

This seemed like a more direct way to start this conversation as opposed to the sea of Issues.
Please correct me if not and I'll submit a proper issue.

Thanks

sindlinger pushed a commit to Orgsindlinger/Auto-GPT-WebUI that referenced this pull request Sep 25, 2024
File Logger that tracks changes to file operations to prevent looping
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants